public class AdminMain {

	public static void main(String[] args) {

		// Get MBank Instance
		MBank mBank = null;
		try {
			mBank = MBank.getInstance();
		} catch (DBManagerException e) {
			e.printErrMsg();
		}

		// Admin Login
		AdminActions adminActions = mBank.adminLogin("123");

		if (adminActions == null) {
			System.err.println("[AdminMain]: Invalid Admin Password.");
		} else {
			System.out.println("[AdminMain]: AdminActions object received.");

			// Add new customer
			Customer customer1 = new Customer("Israel Israeli", 565844, "050-6785432", "israelisraeli@gmail.com", "Hertzel 16, Tel-Aviv", " ");
			Account account1 = new Account();
			account1.setAmount(1000);

			// Add Customer(customer1);
			try {
				adminActions.addCustomer(customer1, account1);
				System.out.println("[AdminMain]: New Client Created.");
			} catch (DBManagerException e) {
				System.err.println("[AdminMain]: Client Creation Failed.");
				e.printStackTrace();
			}

			// Update Customer by ID
			Customer customer2 = null;
			try {
				customer2 = adminActions.getCustomerById(8);
				customer2.setComments("VIP");
				adminActions.updateCustomerbyAdminAction(customer2);
				System.out.println("[AdminMain]: Client updated:" + customer2.getCustId());
			} catch (DBManagerException e) {
				System.err.println("[AdminMain]: Client update Failed.");
				e.printErrMsg();
			}

			// Delete Customer by ID
			Customer customer3 = new Customer();

			try {
				customer3.setCustId(8);
				adminActions.deleteCustomer(customer3);
				System.out.println("[AdminMain]: Client deleted: " + customer3.getCustId());
			} catch (DBManagerException e) {
				System.err.println("[AdminMain]: Client delete Failed: " + customer3.getCustId());
				e.printErrMsg();
			}

		}

		mBank.closeConnection();
	}
}
